#ifndef __SYM_TAB
#define __SYM_TAB

#include <map>
#include <string>

using namespace std;

namespace xEngine
{
    namespace PlatformIndependent
    {
        template <typename T>
        class SymTable
        {
        private:
            map<string, T> symbolTable;

        public:
            //
            // Return's symbol's value
            //
            T getSymValue(string id) {
                return this->symbolTable[id];
            }

            //
            // Seeks form symbol
            //
            bool containsSym(string id) {
                return this->symbolTable.find(id) != this->symbolTable.end();
            }

            //
            // Insert symbol
            //
            void insertSym(string id, T value) {
                this->symbolTable.insert( pair<string, T>(id, value) );
            }

            //
            // Updates symbol
            //
            void updateSym(string id, T value) {
                //map<string, T>::iterator it;// = this->symbolTable.find(id);
             /*   iterator<string, T> it = this->symbolTable.find(id);

                if (it != this->symbolTable.end()) {
                    // OK, symbol is in symtab.
                    (*it).second = value;
                }*/

                (* this->symbolTable.find(id)).second = value;
            }

            //
            // Delete all from table
            //
            void clear() {
                this->symbolTable.clear();
            }
        };
    }
}



#endif
